import jsencrypt from '@/components/jsencrypt-Rsa/jsencrypt/jsencrypt.vue';
// import { BASE_URL } from './ip'
import Vue from 'vue'
export const encrypt = (publicKey, data) => {
  return jsencrypt.setEncrypt(publicKey, data)
}

export const getPublicKey = event => {
  return new Promise((resolve, reject) => {
    event.$get("getPwdKey").then(data => {
      // uni.showToast({title: data, icon: 'none'})
      if (data) {
        resolve(data.data)
      } else {
        reject(new Error('请求失败'))
      }
    }).catch(e => {
      reject(e)
    })
  })
}
